package org.lc.stk.web.dto.question;

import org.lc.stk.model.question.Question;
import org.lc.stk.model.question.attrs.QuestionState;
import org.lc.stk.model.question.attrs.QuestionType;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "试题响应DTO")
public class QuestionResponseDTO {
    
    @Schema(description = "试题ID")
    private Long id;
    
    @Schema(description = "题型")
    private QuestionType type;
    
    @Schema(description = "状态")
    private QuestionState state;
    
    @Schema(description = "创建时间")
    private String createTime;
    
    @Schema(description = "更新时间")
    private String updateTime;

    public QuestionResponseDTO() {
    }

    public QuestionResponseDTO(Question question) {
        if (question != null) {
            this.id = question.getId();
            this.type = question.getType();
            this.state = question.getState();
            this.createTime = question.getCreateDate() != null ?
                            question.getCreateDate().toString() : null;
            this.updateTime = question.getUpdateDate() != null ?
                            question.getUpdateDate().toString() : null;
        }
    }
    
    public QuestionResponseDTO(QuestionResponseDTO dto) {
        if (dto != null) {
            this.id = dto.getId();
            this.type = dto.getType();
            this.state = dto.getState();
            this.createTime = dto.getCreateTime();
            this.updateTime = dto.getUpdateTime();
        }
    }

    // Getters and Setters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public QuestionType getType() {
        return type;
    }

    public void setType(QuestionType type) {
        this.type = type;
    }

    public QuestionState getState() {
        return state;
    }

    public void setState(QuestionState state) {
        this.state = state;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }
}